package com.han.cloud.controller;

import com.han.cloud.dto.TradeDTO;
import com.han.cloud.dto.WrapperResponse;
import com.han.cloud.service.PaymentService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author hanky
 * @date 2021/10/17
 */
@RestController
public class PaymentController {

    @Resource
    private PaymentService paymentService;

    @PostMapping("/saveTrade")
    public WrapperResponse<String> saveTrade(@RequestBody TradeDTO tradeDTO) {
        String id = paymentService.saveTrade(tradeDTO);
        return WrapperResponse.success(id);
    }

    @PostMapping("/getTrade")
    public WrapperResponse<TradeDTO> getTrade(@RequestBody String id) {
        TradeDTO tradeDTO = paymentService.getTrade(id);
        return WrapperResponse.success(tradeDTO);
    }
}
